package com.acme.exchange.domain.order;

import java.math.BigDecimal;

import com.acme.exchange.network.proto.Protocol.ExchangeMessage.OrderType;
import com.acme.exchange.network.proto.Protocol.ExchangeMessage.Side;

public class Order {
	private int oderID;
	private BigDecimal price;
	private OrderType orderType;
	private int volume;
	private Side opType;
	private String login; //connection between order and user created it
	private int clOrderId;
	
	public Order(int oderID, BigDecimal price, int numbOfShares, Side opType, String login, int clientOrderId) {
		this.oderID = oderID;
		this.price = price;
		this.volume = numbOfShares;
		this.opType = opType;
		orderType = OrderType.LIMIT;
		this.login = login;
		clOrderId = clientOrderId;
	}
	
	public Order(int oderID, int numbOfShares, Side opType, String login, int clientOrderId) {
		this.oderID = oderID;		
		this.volume = numbOfShares;
		this.opType = opType;
		orderType = OrderType.MARKET;
	}

	public int getOderID() {
		return oderID;
	}
	
	public int getClientOderID() {
		return clOrderId;
	}
	
	public String getClientLogin() {
		return login;
	}

	public BigDecimal getPrice() {
		return price;
	}
	
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	public int getVolume() {
		return volume;
	}
	
	public void setVolume(int volume) {
		this.volume = volume;
	}

	public Side getOpType() {
		return opType;
	}
	
	public OrderType getOrderType() {
		return orderType;
	}
	
	public int getUserID() {
		return clOrderId;
	}

	@Override
	public String toString() {
		return "Order [oderID=" + oderID + ", price=" + price + ", volume="
				+ volume + ", opType=" + opType + ", userID=" + clOrderId + "]";
	}	
	
}
